/*(function(){*/


	var mainParam = {
		/**
		 * 初始化左边树结构
		 */
		initLeftTree:function(){
			<!--
			//调用后台接口，取得树形结构的列表
			//转圈
			common.showLoading();
			var url = "/PCIndustryChart/pc/ztreeQuery";
			common.interfaceAjaxFunction(url,"",this.showLeftPartTreeSuccess,true,"",true);

			//-->
		},
		/**
		 * 调用取得树的结构,然后进行数据的渲染
		 */
		showLeftPartTreeSuccess:function(json){
			//成功时候
	    	if(json.status == "0"){
	    		if(json.data.length > 0){
		    		//加载设置后的主页面
	    			mainParam.showLeftPartTree(json.data);
	    		}else{
	    			//加载设置页面
	    			common.show_error("当前无行业树结构数据，请联系管理员维护");
	    		}
	    	}else{
	    		//给出信息提示
	    		common.show_error(json.message);
	    	}
	    	//转圈提示去除
	    	common.hideLoading();
		},
		/**
		 * 显示showLeftPartTree函数，渲染显示数据
		 */
		showLeftPartTree:function(jsonData){
			var setting = {
					data: {
						key: {
							title: "title"
						},
						simpleData: {
							enable: true
						}
					},
					callback: {
						onClick: mainParam.onTreeNodeClick,
					}
				};
			//公共用的树结构
			var zNodes =[];
			//循环得到的data数据，然后进行push到zNodes中去
			for(var i=0;i<jsonData.length;i++){
				var jsonDataRow = jsonData[i];
				var jsonStruct = {
					id:	jsonDataRow.pk_industry_chart,
					pId:jsonDataRow.fw_parent,
					name:jsonDataRow.cate_name,
					title:jsonDataRow.cate_name
				};
				//压入到树结构中去
				zNodes.push(jsonStruct);
			}
			$.fn.zTree.init($("#leftTree"), setting, zNodes);
			$("#hideNodesBtn").bind("click", {type:"rename"}, this.hideTreeNodes);
			$("#showNodesBtn").bind("click", {type:"icon"}, this.showTreeNodes);
		},
		/**
		 * 设置树的title
		 */
		setTreeTitle:function(node) {
			var zTree = $.fn.zTree.getZTreeObj("leftTree");
			var nodes = node ? [node]:zTree.transformToArray(zTree.getNodes());
			for (var i=0, l=nodes.length; i<l; i++) {
				var n = nodes[i];
				n.title = "[" + n.id + "] isFirstNode = " + n.isFirstNode + ", isLastNode = " + n.isLastNode;
				zTree.updateNode(n);
			}
		},
		/**
		 * 显示树的节点
		 */
		showTreeNodes:function() {
			var zTree = $.fn.zTree.getZTreeObj("leftTree"),
			nodes = zTree.getNodesByParam("isHidden", true);
			zTree.showNodes(nodes);
			mainParam.setTreeTitle();
			mainParam.countTree();
		},
		/**
		 * 隐藏输的节点
		 */
		hideTreeNodes:function() {
			var zTree = $.fn.zTree.getZTreeObj("leftTree"),
			nodes = zTree.getSelectedNodes();
			if (nodes.length == 0) {
				alert("请至少选择一个节点");
				return;
			}
			zTree.hideNodes(nodes);
			mainParam.setTreeTitle();
			mainParam.countTree();
		},
		/**
		 * 单击的时候调用查询事件
		 */
		onTreeNodeClick:function(event, treeId, treeNode, clickFlag){
			//layer.msg(treeNode.level + ",clickFlag ==" + clickFlag);
			//设备和工序上面加上单击事件
			if(clickFlag == "1"){// && (treeNode.level == "2" || treeNode.level == "3")
				//事件绑定
				//记录当前的type
				window.sessionStorage.searchKmType = "";
				window.sessionStorage.searchKmKey = treeNode.name;
				window.sessionStorage.searchOrderKey = "publish_time";
				$("#searchInput").val(treeNode.name);
				window.location.href = "#/moreKmInfoList/" + treeNode.name ;
			}
		},
		/**
		 * 查询数的数目
		 */
        countTree:function() {
			var zTree = $.fn.zTree.getZTreeObj("leftTree"),
			hiddenCount = zTree.getNodesByParam("isHidden", true).length;
			$("#hiddenCount").text(hiddenCount);
		},
		/**
		 * 初始化窗口高度
		 */
		initPageHeight:function(){
			//整体高度
			var winHeight = $(window).height();
			//top高度
			var winTopHeight = $(".shell-top-box").height();
			var leftPartHeight = winHeight-winTopHeight-$("#tabHdLeftTitle").height()- 30 - 30;
			//左边的高度为
			$(".leftHeight").height(leftPartHeight > 600 ? leftPartHeight : 600);
			//设定宽度
			var leftWidth = $("#layout-t").width();
			$(".leftHeight").width(leftWidth);
		},
		/**
		 * 初始化饼状图，左边的
		 */
		initLeftPieChart:function(){
			//调用后台接口，取得数据，然后拼接
			var param = {
				pk_user:window.localStorage.userid	
			};
			//转圈
			common.showLoading();
			var url = "/PCpublish/queryKnowledgeCount";
			common.interfaceAjaxFunction(url,param,this.queryKnowledgeCountSuccess,true);
		},
		/**
		 * 查询左边pie图的数据
		 */
		queryKnowledgeCountSuccess:function(json){
			//成功时候
	    	if(json.status == "0"){
	    		if(json.data.length > 0){
		    		//加载设置后的主页面
	    			mainParam.showLeftPartPieChart(json.data);
	    		}else{
	    			//加载设置页面
	    			common.show_error("当前无知识数据","leftPieChart");
	    		}
	    	}else{
	    		//给出信息提示
	    		common.show_error(json.message);
	    	}
	    	//转圈提示去除
	    	common.hideLoading();
		},
		/**
		 *显示左边饼状图 
		 */
		showLeftPartPieChart:function(jsonData){
			//下面拼接html
			var pieChartHtml = "<table id='myTable1'><thead><tr>";
			var piechartMidStr = "</tr></thead><tbody><tr>";
			var pieChartEndStr = "</tr></tbody></table>"
			var mainleftPart = "<th></th>";
			var mainRightPart = "";
			//下面循环所有数据
			for(var i=0;i<jsonData.length;i++){
				var jsonDataRow = jsonData[i];
				var publish_title = jsonDataRow.publish_title == undefined ? "未知" : jsonDataRow.publish_title;
				mainleftPart += "<th>"+publish_title+"&nbsp;"+jsonDataRow.nuu+"</th>";
				mainRightPart += "<td>"+jsonDataRow.nuu+"</td>";
			}
			//最后完成拼接
			$("#leftPieChart").html(pieChartHtml + mainleftPart + piechartMidStr + mainRightPart + pieChartEndStr);
			////console.log($("#leftPieChart").html());
			//初始化数据，然后显示
			gvChartInit();
			$(document).ready(function(){
				//初始化pie图表
				//初始化pie图表
				$('#myTable1').gvChart({
					chartType: 'PieChart',
					gvSettings: {
						vAxis: {title: '知识数量'},
						hAxis: {title: '知识数量'},
						width: "100%",
						height: 310
					}
				});
			});
		},
		/**
		 * 柱状图，右边数据初始化
		 */
		initRightColumChart:function(){
			var param = {
					pk_user:window.localStorage.userid	
				};
			//转圈
			common.showLoading();
			var url = "/PCfavorite/queryCountfavorite";
			common.interfaceAjaxFunction(url,param,this.queryCountfavoriteSuccess,true);
		},
		/**
		 * 查询收藏结果
		 */
		queryCountfavoriteSuccess:function(json){
			//成功时候
	    	if(json.status == "0"){
	    		if(json.data.length > 0){
		    		//加载设置后的主页面
	    			mainParam.showRightPartColumChart(json.data);
	    		}else{
	    			//加载设置页面
	    			common.show_error("当前无收藏数据","rightColumnChart");
	    		}
	    	}else{
	    		//给出信息提示
	    		common.show_error(json.message,"rightColumnChart");
	    	}
	    	//转圈提示去除
	    	common.hideLoading();
		},
		/**
		 * 显示右边树状图
		 */
		showRightPartColumChart:function(jsonData){

			//下面拼接html
			var chartJson = [];
			//下面循环所有数据
			for(var i=0;i<jsonData.length;i++){
				var jsonDataRow = jsonData[i];
				var publish_title = jsonDataRow.publish_title == undefined ? "未知" : jsonDataRow.publish_title;
				
				var json = {
					"name":publish_title,
					"y":parseInt(jsonDataRow.countpk),
					"drilldown":publish_title
				};
				chartJson.push(json);
			}
			 $('#rightColumnChart').highcharts({
	                chart: {
	                    type: 'column'
	                },
	                title: {
	                    text: ''
	                },
	                subtitle: {
	                    text: ''
	                },
	                xAxis: {
	                    type: 'category'
	                },
	                yAxis: {
	                    title: {
	                        text: ''
	                    }
	                },
	                legend: {
	                    enabled: false
	                },
	                plotOptions: {
	                    series: {
	                        borderWidth: 0,
	                        dataLabels: {
	                            enabled: true,
	                            format: '{point.y}'
	                        }
	                    }
	                },
	                tooltip: {
	                    headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
	                    pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y}</b><br/>'
	                },
	                series: [{
	                    name: '类型',
	                    colorByPoint: true,
	                    data: chartJson
	                }]
	            });
		},
		/**
		 * 查询最新的列表数据
		 */
		initNewestKmList:function(){
			//调用后台接口，取得数据，然后拼接
			var param = {
				pk_user:window.localStorage.userid	
			};
			//转圈
			common.showLoading();
			var url = "/PCpublish/queryRecentKnowledges";
			common.interfaceAjaxFunction(url,param,this.queryRecentKnowledgesSuccess,true,"",true);
		},
		queryRecentKnowledgesSuccess:function(json){
			//成功时候
	    	if(json.status == "0"){
	    		if(json.data.length > 0){
		    		//拼接显示数据
	    			$("#recentKnowledges").html("");
	    			var jsonDataLength = json.data.length > 10 ? 10:json.data.length;
	    			for(var i=0;i<jsonDataLength;i++){
	    				var thisRowData = json.data[i];
	    				//为空就不在显示了
	    				if(thisRowData.publish_title == undefined) continue;
	    				//文章id  pk_km_publish
	    				var recentKnowledgesStr = '<li><a class="publish_title" data-id="'+thisRowData.pk_km_publish+'">'+thisRowData.publish_title+"</a><span>"+thisRowData.publish_time+"</span></li>"
	    				//加入
	    				$("#recentKnowledges").append(recentKnowledgesStr);
	    			}
	    			$(".publish_title").unbind().on("click",function(){
						mainParam.toKmMaintanceReading($(this).attr("data-id"));
					});
	    		}else{
	    			//加载设置页面
	    			common.show_error("当前无最新数据","recentKnowledges");
	    		}
	    	}else{
	    		//给出信息提示
	    		common.show_error(json.message,"recentKnowledges");
	    	}
	    	//转圈提示去除
	    	common.hideLoading();
		},
		/**
		 * 查询最热的列表数据
		 */
		initHostKmList:function(){
			//调用后台接口，取得数据，然后拼接
			var param = {
				pk_user:window.localStorage.userid	
			};
			//转圈
			common.showLoading();
			var url = "/PCpublish/queryKmpublishfavoaritecomment";
			common.interfaceAjaxFunction(url,param,this.queryKmpublishfavoaritecommentSuccess,true,"",true);
		},
		/**
		 * 跳转到知识详情界面
		 */
		toKmMaintanceReading:function(pk_publish){
			////console.log(pk_publish+"++++");
			window.open("html/kmMaintanceReading.html?pk_publish="+pk_publish);
		},
        /**
         * 查找最热的知识返回值处理
         */
		queryKmpublishfavoaritecommentSuccess:function(json){
			//成功时候
	    	if(json.status == "0"){
	    		if(json.data.length > 0){
		    		//拼接显示数据
	    			$("#favoaritecomment").html("");
	    			var jsonDataLength = json.data.length > 10 ? 10:json.data.length;
	    			for(var i=0;i<jsonDataLength;i++){
	    				var thisRowData = json.data[i];
	    				//为空就不在显示了
	    				if(thisRowData.publish_title == undefined) continue;
	    				var recentKnowledgesStr = '<li><a class="publish_title" data-id="'+thisRowData.pk_km_publish+'">'+thisRowData.publish_title+"</a><span>"+thisRowData.count+"<img src='images/sc-icon.png'></span></li>"
	    				//加入
	    				$("#favoaritecomment").append(recentKnowledgesStr);
	    			}
	    			$(".publish_title").unbind().on("click",function(){
						mainParam.toKmMaintanceReading($(this).attr("data-id"));
					});
	    		}else{
	    			//加载设置页面
	    			common.show_error("当前无最热数据","favoaritecomment");
	    		}
	    	}else{
	    		//给出信息提示
	    		common.show_error(json.message,"favoaritecomment");
	    	}
	    	//转圈提示去除
	    	common.hideLoading();
		},
		/**
		 * 查询所有产品,竞品
		 */
		queryAllProduct:function(type,url){
			
			//调用后台接口，取得数据，然后拼接
			var param = {};
			if (type =="compat") {
				index.competscrollLoading =true;
			  param = {
					type:"1",
					pageNum:common.compatCurrentPage,
					pageSize:20,
				};
			}
			if(type =="product"){
				index.productscrollLoading=true;
				param = {
					type:"1",
					pageNum:common.productCurrentPage,
					pageSize:20,
				};
			}
			
			//转圈
			common.showLoading();
			var url = url;
			common.interfaceAjaxFunction(url,param,this.queryProductSuccess,true,type,true);
		},
		/**
		 * 查询所有产品接口返回值处理
		 */
		queryProductSuccess:function(json,param){
			var container = "";
			if(param == "product"){
				container = "queryAllProduct";
			}else{
				container = "queryCompatible";
			}
			//成功时候
	    	if(json.status == "0"){
	    		if(json.data.length > 0){
	    			index.scrollLoading = true;
		    		//拼接显示数据
	    			for(var i=0;i<json.data.length;i++){
	    				var thisRowData = json.data[i];
	    				if(param == "product"){
	    					var recentKnowledgesStr = "<li class='allProductList' title='"+thisRowData.product_name+"'><a  data-pk='"+thisRowData.pk_product+"'>"+thisRowData.product_name+"</a></li>"
	    				}else{
	    					var recentKnowledgesStr = "<li class='allProductList' title='"+thisRowData.compatible_product_name+"'><a  data-pk='"+thisRowData.pk_compatible+"'>"+thisRowData.compatible_product_name+"</a></li>"
	    				}
	    				//加入
	    				$("#" + container).append(recentKnowledgesStr);
	    				//单击事件的绑定
	    				$(".allProductList").unbind().on("click",function(){
    						//记录当前的type
    						window.sessionStorage.searchKmType = "";
    						window.sessionStorage.searchOrderKey = "publish_time";
    						window.sessionStorage.searchKmKey = $(this).find("a").html();
    						$("#searchInput").val($(this).find("a").html());
    						window.location.href = "#/moreKmInfoList/" + $(this).find("a").html();
	    				});
	    			}
	    		}else{
	    			
	    			if(param == "product"){
	    				if(common.productCurrentPage == 1){
	    					common.show_error("当前无最新数据",container);
	    				}else{
	    					index.productscrollLoading = false;
	    					layer.msg('已加载全部产品');
	    				}
	    			}else{
	    				if(common.compatCurrentPage == 1){
	    					common.show_error("当前无最新数据",container);
	    				}else{
	    					index.competscrollLoading = false;
	    					layer.msg('已加载全部竞品');
	    				}
	    			}
	    		}
	    	}else{
	    		//给出信息提示
	    		common.show_error(json.message);
	    	}
	    	//转圈提示去除
	    	common.hideLoading();
	    	common.loadingData = false;
		},
		/**
		 * 事件的绑定
		 */
		bindEvenRoud:function(){
			$("#moreNewKm").on("click",function(){
				//搜索输入框清空
				$("#searchInput").val("");
				window.sessionStorage.searchKmKey = "";
				window.sessionStorage.searchKmType = "";
				window.sessionStorage.searchOrderKey = "publish_time";
				window.location.href = "#/moreKmInfoList/new";
			});
			
			$("#moreHotKm").on("click",function(){
				//查询用的入参
				window.sessionStorage.searchKmKey = "";
				window.sessionStorage.searchKmType = "";
				window.sessionStorage.searchOrderKey = "ter";
				window.location.href = "#/moreKmInfoList/hot";
			});

			//单击查询时候进行事件监听
			$("#searchButton").unbind().on("click",function(){
				window.sessionStorage.searchKmKey = $("#searchInput").val();
				window.sessionStorage.searchKmType = "";
				window.sessionStorage.searchOrderKey = "publish_time";
				window.sessionStorage.searchKmKey= $("#searchInput").val();
				window.location.href = "#/moreKmInfoList/" + ($("#searchInput").val() == "" ? "search" : $("#searchInput").val());
			});
		},
		/**
		 * 查询知识类别的信息列表
		 */
		initCategoryList:function(){
			//调用后台接口，取得类别的列表
			var param = {
				pk_user:window.localStorage.userid	
			};
			//转圈
			common.showLoading();
			var url = "/PCKnowledgeCategoryEntity/queryAllKnowledgeCateTree";
			common.interfaceAjaxFunction(url,param,this.getAllKnowledgeCategorySuccess,true,"",true);
			
		},
		/**
		 * 调用取得树的结构,然后进行数据的渲染
		 */
		getAllKnowledgeCategorySuccess:function(json){
			//成功时候
	    	if(json.status == "0"){
	    		if(json.data.length > 0){
	    			//先清空
//	    			$("#mainCategoryList").html("<li><a href='javascript:void(0);' class='shellKmTypeTitle' data-pk=''>全部</a></li>");
		    		//显示数据
	    			for(var i=0;i<json.data.length;i++){
	    				if(i<=4){
		    				var categoryRow = json.data[i];
		    				var categoryRowChild = categoryRow.childList;
		    				//根据有无孩子进行处理
		    				var categoryRowList = "";
		    				if(categoryRowChild.length > 0){
		    					categoryRowList +="<li class='dropdown'>"
		    						+"<a href='javascript:void(0);' class='shellKmTypeTitle' data-pk='"+categoryRow.pk_knowledge_category+"'>" + categoryRow.knowledge_category_name  + "</a>"
		    						+"<a href='#' class='dropdown-toggle' data-toggle='dropdown' aria-expanded='true'>"
		    						+"<b class='caret'></b>"
		    						+"</a>"
		    						+"<ul class='dropdown-menu shell-select-bj'>";
		    					//循环孩子节点
		    					for(var j=0;j<categoryRowChild.length;j++){
		    						var categoryRowChildRow = categoryRowChild[j];
		    						categoryRowList +="<li><a href='javascript:void(0);' class='shellKmTypeTitle' data-pk='"+categoryRowChildRow.pk_knowledge_category+"'>"+categoryRowChildRow.knowledge_category_name+"</a></li>";
		    					}
		    					//继续拼接数据
		    					categoryRowList +="</ul>"
		    						+"</li>";
		    				}else{
		    					categoryRowList = "<li><a href='javascript:void(0);' class='shellKmTypeTitle' data-pk='"+categoryRow.pk_knowledge_category+"'>"+categoryRow.knowledge_category_name+"</a></li>";
		    				}
		    				//显示数据
		    				$("#mainCategoryList").append(categoryRowList);
		    				////console.log("显示数据显示数据显示数据显示数据显示数据显示数据显示数据");
	    				}
	    			}
	    			//事件的绑定
	    			$("#mainCategoryList .shellKmTypeTitle").unbind().bind("click",function(){
	    				//当前类别id
	    				var thisTypePk = $(this).attr("data-pk");
	    				if(thisTypePk == ""){
	    					$("#searchInput").val();
	    					window.sessionStorage.searchKmType = "";
		    				window.sessionStorage.searchOrderKey = "publish_time";
		    				window.location.href = "#/moreKmInfoList/searchAll";
	    				}else{
	    					//查询条件
		    				window.sessionStorage.searchKmType = thisTypePk;
		    				window.sessionStorage.searchOrderKey = "publish_time";
		    				window.location.href = "#/moreKmInfoList/" + thisTypePk;
	    				}
	    			});
	    		}else{
	    			//加载设置页面
	    			layer.msg("当前无类别数据，请联系管理员维护！");
	    		}
	    	}else{
	    		//给出信息提示
	    		common.show_error(json.message);
	    	}
	    	//转圈提示去除
	    	common.hideLoading();
		}
	};
	var index = {
		
		/**
		 * 初始化tab事件
		 */
		productscrollLoading :true,
		competscrollLoading :true,
	    initPageTabEven:function(){
	    	$("#layout-t span:first").addClass("current");
			$("#layout-t .tab-bd-con:gt(0)").hide();
			
			$(".tab-hd-con").click(function(){//mouseover 改为 click 将变成点击后才显示，mouseover是滑过就显示
				$(this).addClass("current").siblings("span").removeClass("current");
				$("#layout-t .tab-bd-con:eq("+$(this).index()+")").show().siblings(".tab-bd-con").hide().addClass("current");
				//查询所有产品 
				if($(this).index() == "1" && $("#queryAllProduct").html() == ""){
					mainParam.queryAllProduct("product","/pcBdproduct/queryProductPage");
				}else if($(this).index() == "2" && $("#queryCompatible").html() == ""){
					//查询竞品产品
					mainParam.queryAllProduct("compat","/pcBdCompatible/queryCompatible");
				}
			});
			
			$("#queryCompatible").scroll( function() {
				if (index.competscrollLoading) {
		            var viewH =$(this).height();//可见高度  
		            var contentH =$(this).get(0).scrollHeight;//内容高度  
		            var scrollTop =$(this).scrollTop();//滚动高度  
		            var height = contentH - viewH - scrollTop;
		            if(height<= 100 && !common.loadingData) {
		            	common.loadingData  = true;
		            	common.compatCurrentPage +=1;
		            	mainParam.queryAllProduct("compat","/pcBdCompatible/queryCompatible");
		            }
	            }else{
	            	return;
	            }		   
	            
			}); 
			$("#queryAllProduct").scroll( function() { 
				if (index.productscrollLoading) {
		            var viewH =$(this).height();//可见高度  
		            var contentH =$(this).get(0).scrollHeight;//内容高度  
		            var scrollTop =$(this).scrollTop();//滚动高度  
		            var height = contentH - viewH - scrollTop;
		            if(height<= 100 && !common.loadingData) {
		            	common.loadingData  = true;
		            	common.productCurrentPage +=1;
		            	mainParam.queryAllProduct("product","/pcBdproduct/queryProductPage");
		            }
	            }else{
	            	return;
	            }			   
			});
		},
		/**
		 * 页面路由的绑定
		 */
		bindRount:function(){
			
			//记录状态
			Path.map("#rebackComment").to(function () {
				common.loadPageDiv("html/rebackComment.html");
			});
			//知识阅读的监听路由事件
			// Path.map("#kmMaintanceReading").to(function () {
			// 	window.location.href = "html/kmMaintanceReading.htm"
			// });
			
			//关键子选择
			Path.map("#/moreKmInfoList/:searchKmKey").to(function () {
				common.loadPageDiv("html/shellkmList.html","shellKmListDiv",true);
			});
			
			//首页的监听路由事件
			Path.map("").to(function(){
				common.loadPageDiv("html/index.html");
			});
			
			//知识维护
			Path.map("#kmMaintance").to(function(){
				common.loadPageDiv("html/kmMaintance.html");
			});
			

			//库存维护
			Path.map("#keyProductMaintance").to(function(){
				common.loadPageDiv("html/keyProductMaintance.html");
			});

			//商品维护
			Path.map("#keyCompetMaintance").to(function(){
				common.loadPageDiv("html/keyCompetMaintance.html");
			});
			//商品类别维护
			Path.map("#keyIndustryMaintance").to(function(){
				common.loadPageDiv("html/keyIndustryMaintance.html");
			});
			

			//类别维护
			Path.map("#categoryMaintance").to(function(){
				common.loadPageDiv("html/categoryMaintance.html");
			});
			
			//商品发布
			Path.map("#kmMaintanceAdd").to(function () {
				common.loadPageDiv("html/kmMaintanceAdd.html");
			});
			//商品修改
			Path.map("#kmMaintanceUpdate").to(function () {
				common.loadPageDiv("html/kmMaintanceUpdate.html");
			});
			//商品下架
			Path.map("#kmMaintanceDelete").to(function () {
				common.loadPageDiv("html/kmMaintanceDelete.html");
			});
			//订单管理
			Path.map("#bdIndustryChart").to(function () {
				common.loadPageDiv("html/bdIndustryChart.html");
			});
			
			Path.root("");
			Path.listen();
		},
		/**
		 * 
		 */
		getLoginInfo:function(){
			common.showLoading();
			//取得参数
			var urlParam = common.getURLparams();
			var urlParamValueCode = urlParam.ucode;
			if(urlParam.ucode != undefined && urlParam.ucode != ""){
				//保存用户权限信息在session中
    			window.sessionStorage.currentUserCodeInfo = urlParam.ucode;
			}else{
				urlParamValueCode = window.sessionStorage.currentUserCodeInfo;
			}
			var param = {
				"user_name" : urlParamValueCode	
			};
			if(urlParamValueCode == ""){
				//加载设置页面
    			common.show_error("当前用户非法","shellContentBox");
    			$("#shellContentBox").show();
    			common.hideLoading();
    			return false;
			}
			var url = "/shellUser/queryPkByUsercode";
			common.interfaceAjaxFunction(url,param,this.getLoginInfoSuccess,true,"",true);
		},
		getLoginInfoSuccess:function(json){
			//成功时候
	    	if(json.status == "0"){
	    		if(json.data != undefined && json.data.pk_user.length > 0){
		    		//加载设置后的主页面
	    			window.localStorage.userid = json.data.pk_user;
	    			//保存用户权限信息在session中
	    			window.sessionStorage.loginUserInfo = JSON.stringify(json);
	    			//用户合法后，调用主函数
	    			index.indexDataLoad();
	    			//页面显示权限逻辑
	    			index.initUserMenus(json.data.user_role);
	    		}else{
	    			//加载设置页面
	    			common.show_error("当前用户非法","shellContentBox");
	    			$("#shellContentBox").show();
	    			common.hideLoading();
	    			return false;
	    		}
	    	}else{
	    		//给出信息提示
	    		common.show_error(json.message,"shellContentBox");
	    		$("#shellContentBox").show();
	    		common.hideLoading();
	    		return false;
	    	}
	    	//转圈提示去除
	    	common.hideLoading();
		},
		/**
		 * 用户权限设定加入
		 */
		initUserMenus:function(userRole){
            //全部显示
			$("#index_nav_right_part").show();
			//控制隐藏
			switch(userRole)
			{
				case "ADMIN"://系统管理员 显示关键字和类别维护
				  $(".notAdminTitle").hide();
				  break;
				case "ADMINANDMANAGER": //系统管理员  、类别管理员显示全部
				  break;
				case "MANAGER"://类别管理员
					$(".notMANAGER").hide();
				  break;
				default:
				  $(".rightMeunTitle").hide();
			}
		},
		/**
		 * 调用主函数
		 */
		indexDataLoad:function(){
			$("#shellContentBox").show();
			/*//需要根据权限放开右上角权限
			$("#index_nav_right_part").show();*/
			//绑定路由
			index.bindRount();
			//高度初始化
			mainParam.initPageHeight();
			
			//加载左边树结构
			mainParam.initLeftTree();
			//初始化饼状图
			mainParam.initLeftPieChart();
			//初始化右边柱状图
			mainParam.initRightColumChart();
			//查找最新的列表
			mainParam.initNewestKmList();
			//查找最新，最热列表
			mainParam.initHostKmList();
			
			//更多时间监听及路由配置
			mainParam.bindEvenRoud();
			//
			index.initPageTabEven();
			//查询类别数据
			mainParam.initCategoryList();
		},
		initialize : function(){
			common.compatCurrentPage=1;
		    common.productCurrentPage=1;
			//用户信息记录
		    index.getLoginInfo();
		}
	};